﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using Code.Commen;
using Company.Web.Commen;

namespace Company.Web
{

    /// <summary>
    /// 全局应用程序设置
    /// </summary>
    public static class Global
    {
        /// <summary>
        /// 是否启用Url后缀名
        /// </summary>
        public static bool UrlRewrite
        {
            get
            {
                return "1" == ConfigurationManager.AppSettings["UrlRewrite"];
            }
        }
        /// <summary>
        /// 获取Url后缀名
        /// </summary>
        public static string UrlExt
        {
            get
            {
                var urlext = ConfigurationManager.AppSettings["UrlExt"];
                if (string.IsNullOrEmpty(urlext))
                    urlext = ".html";
                else if (!urlext.StartsWith("."))
                    urlext = "." + urlext;
                return urlext;
            }
        }

        /// <summary>
        /// 后台管理的 域名
        /// </summary>
        public static string ManagePath
        {
            get
            {
                string path = ConfigurationManager.AppSettings["ManagerPath"];
                if (string.IsNullOrEmpty(path))
                    path = "manage";
                return path;
            }
        }


        private static HashTable<Guid, LoginAdmin> _InlineAdmin;
        /// <summary>
        /// 在线的管理员
        /// </summary>
        public static HashTable<Guid, LoginAdmin> InlineAdmin
        {
            get
            {
                if (_InlineAdmin == null)
                    _InlineAdmin = new HashTable<Guid, LoginAdmin>();
                return _InlineAdmin;
            }
        }
    }
}